<link rel="stylesheet" href="css/page.css" media="all" />
<link rel="stylesheet" href="css/plist.css" media="all" />
<link rel="stylesheet" href="css/tao1.css"/>
 <style>

.clay{
    width: 1000px;
}
</style>
<div class="clay">
    <div class="content">
        <h1><span>产品预订</span></h1>
        <div class="hotcity">
            <span>热门城市：</span>
            <?foreach($hotcitys as $k=>$value){?>
                <a href="plist.html?destid=<?=$k?>"><?=$value?></a>
            <?}
            //echo $count0,"|",$count,"|",$count1;
            ?>
        </div>
        <form class="search_form" action="">
            <div class="search">
            <div id="bind_tao">
                <div class="input-wrap">
                    <input type="text"  placeholder="请输入景区名称" name="ltitle" id="coop" value="<?=$_REQUEST['ltitle']?>">
                    <button type="submit"id="checkSubmitBtn" class="chkbtn">搜&nbsp;&nbsp;&nbsp;索</button>
                </div>
            </div>
                <dl class="p_type">
                    <dt>产品类别：</dt>
                    <dd>
                        <span><a class="<?=$_REQUEST['p_type']==""?"selected":""?>" p_type="" >全部</a></span>
                        <?foreach($p_types as $key=>$value):?>
                        <span>
                            <a class="s_value <?=($p_type==$key)?"selected":""?>" p_type="<?=$key?>"><?=$value?></a>
                        </span>
                        <?endforeach;?>
                    </dd>
                </dl>
                <!-- <a id="code" class="fr code" href="?p=<?=$_REQUEST['provinceid']?>&t=<?=urlencode($_REQUEST['topic'])?>&d=<?=$_REQUEST['destid']?>">二维码</a> -->
            <?if($p_type=="B"){?>
                <dl class="startplace">
                    <dt>出发地：</dt>
                    <dd>
                        <span><a class="<?=$_REQUEST['startplace']==""?"selected":""?>" startplace="" >全部</a></span>
                        <?foreach($startplaces as $place){?>
                        <span>
                            <a num="<?=++$num_i?>" class="deep_blue <?if($_REQUEST['startplace']==$place) echo "selected"?>" startplace="<?=$place?>"><?=$place?></a>
                        </span>
                        <?}?>
                    </dd>
                </dl>
                <?if(count($startplaces)>8){?><a class="fr more">更多<i>&nbsp;</i></a><?}?>
                <dl class="endplace">
                    <dt>目的地：</dt>
                    <dd>
                        <span><a class="<?=$_REQUEST['endplace']==""?"selected":""?>" endplace="">全部</a></span>
                        <?foreach($endplaces as $place){?>
                        <span>
                            <a num="<?=++$num_i?>" class="deep_blue <?if($_REQUEST['endplace']==$place) echo "selected"?>" endplace="<?=$place?>"><?=$place?></a>
                        </span>
                        <?}?>
                    </dd>
                </dl>
                <?if(count($endplaces)>8){?><a class="fr more">更多<i>&nbsp;</i></a><?}?>
                <dl class="rday">
                    <dt>游玩天数：</dt>
                    <dd>
                        <span><a class="<?=$_REQUEST['rday']==""?"selected":""?>" rday="">全部</a></span>
                        <span>
                            <a class="deep_blue <?=($_REQUEST['rday']==1)?"selected":""?>" rday="1">1日游</a>
                        </span>
                        <span>
                            <a class="deep_blue <?=($_REQUEST['rday']==2)?"selected":""?>" rday="2">2日游</a>
                        </span>
                        <span>
                            <a class="deep_blue <?=($_REQUEST['rday']==3)?"selected":""?>" rday="3">3日游</a>
                        </span>
                        <span>
                            <a class="deep_blue <?=($_REQUEST['rday']==4)?"selected":""?>" rday="4">3日游以上</a>
                        </span>
                    </dd>
                </dl>
                <p></p>
            <?}else{?>
                <dl class="province">
                    <dt>所在省份：</dt>
                    <dd>
                        <span><a class="<?=$_REQUEST['provinceid']==""?"selected":""?>" provinceid="">全部</a></span>
                        <?foreach($province as $provinceid=>$value):?>
                        <span><a num="<?=++$num_i?>" class="s_value <?=($_REQUEST['provinceid']==$provinceid)?"selected":""?>" provinceid="<?=$provinceid?>"><?=$value?></a></span>
                        <?endforeach;?>
                    </dd>
                </dl>
                <?if(count($province)>8){?><a class="fr more">更多<i>&nbsp;</i></a><?}?>
                <dl class="dest">
                    <dt>所在城市：</dt>
                    <dd>
                        <span><a class="<?=$_REQUEST['destid']==""?"selected":""?>" destid="">全部</a></span>
                        <?foreach($destination as $destid=>$value){?>
                        <span><a num="<?=++$num_i?>" class="s_value <?=($_REQUEST['destid']==$destid)?"selected":""?>" destid="<?=$destid?>"><?=$value?></a></span>
                        <?}?>
                    </dd>
                </dl>
                <?if(count($destination)>8){?><a class="fr more">更多<i>&nbsp;</i></a><?}?>
                <dl class="topic">
                    <dt>旅游主题：</dt>
                    <dd>
                        <span><a class="<?=$_REQUEST['topic']==""?"selected":""?>" topic="">全部</a></span>
                        <?foreach($topics as $value){?>
                        <span>
                            <a num="<?=++$num_j?>" class="s_value <?=($_REQUEST['topic']==$value)?"selected":""?>" topic="<?=$value?>"><?=$value?></a>
                        </span>
                        <?}?>
                    </dd>
                </dl>
                <?if(count($topics)>8){?><a class="fr more">更多<i>&nbsp;</i></a><?}?>
                <p></p>
            <?}?>
            
        </div>
        </form>    
        <div id="boxWrap" class="boxs">
            <?foreach($products_list as $lid=>$tickets):?>
            <div class="box <?=$land_list[$lid]['self']?>">
                <div class="product">
                     <div class="imgDiv">
                         <a><img class="small"
                                 src="<?=$land_list[$lid]['imgpath']?>"
                                 onerror="javascript:this.src='http://www.12301.cc/images/sorry_pic.png'"/></a>
                         <div class="bigpic none">
                             <img class="normal"
                                  src="<?=$land_list[$lid]['imgpath']?>"
                                  onerror="javascript:this.src='http://www.12301.cc/images/sorry_pic.png'"/>
                         </div>
                     </div>
                     <div class="linfo">
                         <ul class="">
                             <li>
                                 <a class="title"
                                    href="scenicDetail.html?lid=<?=$lid?>&did=<?=$memberID?>"
                                    target="_blank" ><?=$land_list[$lid]['title']?></a>
                                 <span class="area"><?=$land_list[$lid]['area_name']?></span>
                             </li>
                             <li>
                                 <span class="supply">供应商：<?=$apply_info[$land_list[$lid]['apply_did']]['dname']?> </span>
                            <span class="qq">
                                <?if($apply_info[$land_list[$lid]['apply_did']]['qq']){?>
                                    <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=<?=$apply_info[$sapply_did]['qq']?>&site=qq&menu=yes"><img onerror="this.parentNode.removeChild(this)" border="0" src="http://wpa.qq.com/pa?p=2:<?=$apply_info[$sapply_did]['qq']?>:52" alt="点击这里给我发消息" title="点击这里给我发消息"/></a>
                                <?}?>
                            </span>
                             </li>
                             <li>地址：<?=$land_list[$lid]['addr']?></li>
                         </ul>
                     </div>
                     <div class="detail">
                    <span class="dollar"><i>&yen;</i>
                    <strong class="minpricenum"></strong></span>起</br>
                         <!--<a class="checkBtn" href="scenicDetail.html?lid=<?=$lid?>&did=<?=$memberID?>" target="_blank">散客预订</a></br>-->
<!--                         <a target="_blank" href="dcode.html?lid=--><?//=$lid?><!--&aid=--><?//=$sapply_did?><!--"><img width="18" src="http://www.16u.cc/d/images/dcode.jpg"/>二维码</a>-->
                     </div>
                 </div>
                <div class="ticketlist">
                    <dl class="header">
                        <dt class="id">产品ID</dt>
                        <dt class="title">门票类型</dt>
                        <dt class="applyer">供应商</dt>
                        <!-- <dd class="sapply_did title <?=$_SESSION['sdtype']!=0?"hidden":""?>">产品供应</dd> -->
                        <dd class="price">门市价</dd>
                        <dd class="price">建议零售价</dd>
                        <dd class="price">结算价</dd>
                        <dd class="paymethod">支付方式</dd>
                        <dd class="qr">二维码</dd>
                    </dl>
                    <?php foreach($tickets as $ticket):?>
                        <?php $price = getPrice( $s, $ticket['pid'], $Y_m_d, $ticket['sid']);?>
                        <dl class="ticket">
                            <dt class="id" title="供应商aid|景区lid|门票tid"><?=$ticket['sid'],'|',$lid,'|',$ticket['tid']?></dt>
                            <dt class="title">
                                <a href="javascript:;"><?=$ticket['title']?><i class="down_arrow arrow">&nbsp;</i></a>
                            </dt>
                            <dd class="applyer" data-sid="<?=$ticket['sid']?>"><?=$apply_info[$ticket['sid']]['dname']?></dd>
                            <dd class="price tprice"><i class="dollar">&yen;</i><em class="stnum"><?=$ticket['tprice']?></em></dd>
                            <?php if($price==-1):?>
                                <dd class="price lprice">已过期</dd>
                                <dd class="price jsprice">已过期</dd>
                                <dd class="paymethod"><a><?=$ticket['pay']==1?"在线支付":"现场支付"?></a></dd>
                                <dd class="operate"></dd>
                                <dd></dd>
                            <?php else:?>
                            <dd class="price lprice"><i class="dollar">&yen;</i><em class="stnum"><?=$price['uprice']/100?></em></dd>
                            <dd class="price jsprice"><strong><i class="dollar">&yen;</i><em class="stnum"><?=$price['jsprice']/100?></em></strong></dd>
                            <dd class="paymethod"><?=$ticket['pay']==1?"在线支付":"现场支付"?></dd>
                            <dd class="operate">
                                <a class="btn <?=($ticket['pay']=="0")?"live":""?>"
                                   target="_blank"
                                   href="productOrder.html?pid=<?=$ticket['pid']?>&aid=<?=$ticket['sid']?>">&nbsp;</a>
                            </dd>
                            <dd>
                                <a target="_blank" href="dcode.html?lid=<?=$lid?>&aid=<?=$ticket['sid']?>">
                                    <img width="18" src="http://www.16u.cc/d/images/dcode.jpg"/></a>
                            </dd>
                            <?php endif;?>
                        </dl>
                        <div class="tips none">
                            <p>
                                <?=$ticket['notes']?$ticket['notes']."</br>":""?>
                                <span>门票类型：电子票</span>
                                <?php
                                // 有效期
                                if($ticket['delaydays']>0){
                                    if($ticket['delaytype']==0) $usetime = '游玩日期(含)'.$ticket['delaydays'].'天内有效';
                                    if($ticket['delaytype']==1) $usetime = '下单日期(含)'.$ticket['delaydays'].'天内有效';
                                }
                                if($ticket['order_start']!='' && $ticket['order_end']!=''){
                                    $usetime = $ticket['order_start'].' 至 '.$ticket['order_end'];
                                }elseif($ticket['order_start']=='' && $ticket['order_end']!=''){
                                    $usetime = '截止'.$row['order_end'];
                                }

                                if($ticket['order_start']=='' && $ticket['delaydays'] == 0){
                                    $usetime = '当天有效';
                                }
                                ?>
                                <span>有效期限：<?=$usetime?></span>
                                <span><?=$ticket['getaddr']?></span>
                            </p>
                            <div class="bottom">
                                <a>隐藏<i class="arrow up_arrow">&nbsp;</i></a>
                            </div>
                        </div>
                    <?php endforeach;?>
                </div>
            </div>
            <?endforeach;?>
            <?if(count($products_list)==0):?>
            <div class="noresult">
                <?if($_SERVER['QUERY_STRING']):?>
                <h3>没有找到符合条件的产品，你可以:</h3>
                <p>
                    试着修改搜索条件<br>
                    查看搜索关键词是否有错误的输入
                </p>
                <?else:?>
                <p>暂无可分销门票产品!</p>
                <?endif;?>
            </div>
            <?else:?>
            <div class="page"><?page($total,$cp,$size,$order,$by);?></div>
            <?endif;?>
        </div>
    </div>
</div>
<script type="text/javascript" src="js/global/Url.js"></script>
<script type="text/javascript" src="js/ui/PopWindow.js"></script>
<script>

    //计算最低价
    var getMinprice = function(){
        $("#boxWrap").children(".box").each(function(index,box){
            var item = $(this);
            var prices = item.find(".jsprice em.stnum");
            var min = prices.eq(0).text();
            prices.each(function(i,p){
                var price = $(this).text();
                if(price<min) min = price;
            })
            item.find(".minpricenum").text(min);
        })
    };


    var popBox=new PopWindow();
    $("#code").click(function(){
        var url="call/handle.php"+$(this).attr("href");
        $.ajax({
            "url":url,
            "data":{"from":"index_code"},
            "success":function(href){
                popBox.open("<a class='close'>&nbsp;</a><img src='"+href+"'/>");
                $("#popBox a.close").click(function(){
                    popBox.close();
                })
            }
        })
        return false;
    })
    /*景点类别选择框初始化*/
    $(".search dl dd a").each(function(){
        if($(this).hasClass("selected")&&$(this).attr("num")>8){
            $(this).parent().parent().addClass("show");
        }
    })
    $("ul.order a").bind("click",function(){
        var params={};
        params["orderby"]=$(this).attr("order");
        Url.addParams(params);
        window.location=Url.getLocation();
        return false;
    })
    $(".search a.more").click(function(){
        if($(this).prev().find("dd").first().hasClass("show")){
            $(this).prev().find("dd").first().removeClass("show");
        }else{
            $(this).prev().find("dd").first().addClass("show");
        }
        if($(this).hasClass("unfold")){
            $(this).removeClass("unfold");
        }else{
            $(this).addClass("unfold");
        }
    })
    /*景区搜索框js脚本*/
    $(".search dl dd a").bind("click",function(){
        var parent=$(this).parent().parent().parent().attr("class");
        var params={};    
        if(parent.indexOf("province")!=-1){
            params["provinceid"]=$(this).attr("provinceid");
            Url.setParams({"destid":""});
            Url.setParams({"topic":""});
        }
        if(parent.indexOf("dest")!=-1){
            params["destid"]=$(this).attr("destid");
            Url.setParams({"topic":""});
        }
        if(parent.indexOf("topic")!=-1){
            params["topic"]=$(this).attr("topic");
        }
        if(parent.indexOf("p_type")!=-1){
            params["p_type"]=$(this).attr("p_type");
        }
        if(parent.indexOf("startplace")!=-1){
            params["startplace"]=$(this).attr("startplace");
        }
        if(parent.indexOf("endplace")!=-1){
            params["endplace"]=$(this).attr("endplace");
        }
        if(parent.indexOf("rday")!=-1){
            params["rday"]=$(this).attr("rday");
        }
        if(parent.indexOf("priceType")!=-1){
            params["priceType"]=$(this).attr("priceType");
        }
        Url.addParams(params);
        Url.setParams({"currentPage":1});
        window.location=Url.getLocation();
    })
    $("dl.ticket dt.title a").click(function(){
        var iHtml=$(this).find("i").first();
        if(iHtml.hasClass("down_arrow")){
            $(this).parent().parent().next().removeClass("none");
            iHtml.removeClass("down_arrow");
            iHtml.addClass("up_arrow");
        }else{
            $(this).parent().parent().next().addClass("none");
            iHtml.removeClass("up_arrow");
            iHtml.addClass("down_arrow");
        }
    })
    $("div.tips .bottom a").click(function(){
        $(this).parent().parent().prev().find("dt.title a").click();
    });
    $(".all_ticekt a").click(function(){
        var iHtml=$(this).find("i").first();
        if(iHtml.hasClass("down_arrow")){
            $(this).parent().parent().find("dl.more").removeClass("none");
            iHtml.removeClass("down_arrow");
            iHtml.addClass("up_arrow");
            $(this).children().first().text("收起所有门票类型");
        }else{
            $(this).parent().parent().find("dl.more").addClass("none");
            $(this).parent().parent().find("dl.more").next().addClass("none");
            iHtml.removeClass("up_arrow");
            iHtml.addClass("down_arrow");
            $(this).children().first().text("查看所有门票类型");
        }
    });
    $("a.show_all").click(function(){
        var table=$(this).parent().parent().parent();
        if($(this).hasClass("show_all")){
            table.find(".show_more").removeClass("display_none");
            $(this).html("收起全部");
            $(this).removeClass("show_all");
        }else{
            table.find(".show_more").addClass("display_none");
            $(this).html("显示全部");
            $(this).addClass("show_all");
        }
        return false;
    });
    (function(){
        var t;
        $(".imgDiv .small").mouseover(function(){
            var imgDiv=$(this).parent().next()
            t=setTimeout(function(){
                imgDiv.removeClass("none");
                imgDiv.children().first().animate({width:"350px"});},"500");
        }).mouseout(function(){
            clearTimeout(t);
            $(this).parent().next().addClass("none");
            $(this).parent().next().children().first().width(0);
        });
        getMinprice();
    })();
    
    
</script>